//注释对象
type Person = {
  name:string,
  age:number,
}

const p:Person = {
  name:'张三',
  age:18,
}

console.log(p);

type GoodsType = {
  id:string,
  price:number,
}

//  --------- 2. type 交叉类型(相当于 interface 的继承) ---------
// 交叉类型 &

type DisGoodsType = GoodsType & {
  discount:number,
}

const d1:DisGoodsType = {
  id:'1',
  price:100,
  discount:0.9,
}

console.log(d1);


// --------- 3. type 思考题，对象嵌套 ---------
type Response = {
  code:number
  msg:string
  data:Article
}

type Article = {
  title:string
  desc:string
}

const res:Response = {
  code:200,
  msg:'success',
  data:{
    title:'标题',
    desc:'描述'
  }
}

console.log(res);

